<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="loginBtn">登录</button>

    <script src="getSingle.js"></script>
    <script>
        function createLoginLayer(datetime) {
            console.log(`[${datetime}] createLoginLayer...`);
            let div = document.createElement('div');
            div.innerHTML = '我是登录浮窗';
            div.style.display = 'none';
            document.body.appendChild(div);
            return div;
        }
        let createSingleLoginLayer = getSingle(createLoginLayer);

        document.getElementById('loginBtn').onclick = () => {
            let loginLayer = createSingleLoginLayer( new Date().toLocaleString() );
            loginLayer.style.display = 'block';
        }
    </script>
</body>

</html>